﻿
@{
    ViewBag.Title = "CommentIndex";
}

@{
    ViewBag.Title = "群空间内容列表";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<section class="content-header">
    <h1>
        群空间内容管理
        <small></small>
    </h1>
    <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i>主页</a></li>
        <li class="active">群空间内容列表</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">
                <div class="box-header">
                    <form id="search-form" class="form-inline">
                        <div class="form-group">
                            <label>内容ID</label>
                            <input type="text" class="form-control" style="width:100px;" name="CommentID" autocomplete="off" />
                        </div>
                        <div  class="form-group">
                            <label>简介</label>
                            <input type="text" class="form-control" style="width:100px;" name="CommentDesc" autocomplete="off" />
                        </div>
                        <div  class="form-group" style="display:none">
                            <label>用户名</label>
                            <input type="text" class="form-control" style="width:100px;" name="UserName" autocomplete="off" />
                        </div>
                        <div  class="form-group" style="display:none">
                            <label>创建人ID</label>
                            <input type="text" class="form-control" style="width:100px;" name="UserID" autocomplete="off" />
                        </div>
                        <div  class="form-group" style="display:none">
                            <label>OpenID</label>
                            <input type="text" class="form-control" style="width:300px;" name="OpenID" autocomplete="off" />
                        </div>
                        <div class="form-group">
                            <button type="button" class="btn btn-success btn-sm" id="btnSearch">查找</button>
                        </div>

                        <h3 class="box-title"></h3>
                    </form>
                </div>
                <!-- /.box-header -->
                <div class="box-body table-responsive no-padding" id="parData">
                </div>
                <div class="box-footer clearfix ">
                    <ul id="pagination" class="pagination pagination-sm no-margin pull-right"></ul>
                </div>
                <!-- /.box-body -->
                <!-- /.box -->
            </div>
        </div>
    </div>
</section>
@section scriptsBottom{
    <script type="text/javascript">
        $(document).ready(function () {
            $("#btnSearch").click(function () {
                pageIndex = 1;
                list();
            });
            list();
        });

        //页码
        var pageIndex = 1;
        //查询
        function list() {
            var fdata = $("#search-form").serializeJson();
            var url = '@Url.Action("GroupCommentParList", "GroupComment")' + "?page=" + pageIndex;
            //查询列表
            BMCW.ajax({
                url: url,
                type: 'POST',
                data: fdata,
                dataType: "html",
                success: function (data) {
                    document.getElementById('parData').innerHTML = data;
                    //分页显示
                    $('#pagination').twbsPagination("destroy");
                    $('#pagination').twbsPagination({
                        totalItems: document.getElementById('total').value,
                        visiblePages: 10,
                        pageSize: 10,
                        startPage: parseInt(pageIndex),
                        onPageClick: function (event, page) {
                            pageIndex = page;
                            list();
                        }
                    });
                }
            });
        }

    function detail(id) {
        window.location.href = "@Url.Action("GroupCommentInfo", "GroupComment")" + "?id=" + id;
        };
        function del(id) {
            BMCW.ajax({
                    url: "@Url.Action("CommentDelete", "GroupComment")?id=" + id ,
                        type:"POST",
                        success: function (data) {
                            if (data.status == 0) {
                                BMCW.alert("删除成功");
                                setTimeout(function () {
                                    window.location.reload();
                                }, 2000);
                            } else {
                                BMCW.alert(data.message);
                            }
                        }
                    });
        }
    </script>
}
